package exp.day02;

//凯撒密码解密
public class P03_解密 {
    public static void main(String[] args) {
        String s = "L oryh Rshudwh Vbvwhp dqg Mdyd surjudpplqj!";
        for (int offset = 1; offset < 26; offset++) {
            StringBuffer buf = new StringBuffer();
            for (char c : s.toCharArray()) {
                if (!Character.isLetter(c)) {
                    buf.append(c);
                    continue;
                }
                if (Character.isUpperCase(c)) {
                    int x = c - 'A';
                    int y = (x + offset) % 26;
                    char ch = (char) ('A' + y);
                    buf.append(ch);
                } else {
                    int x = c - 'a';
                    int y = (x + offset) % 26;
                    char ch = (char) ('a' + y);
                    buf.append(ch);
                }
            }
            System.out.println(offset+"\t"+buf.toString());
        }
    }
}
